<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// Soft line break after white space
const kStyle = 'line-break:after-white-space; width:100px; font: 20px monospace;';
selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">|line1 line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">|line1 line2 a line3</div>`,
  '22-0 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">l|ine1 line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">|l^ine1 line2 a line3</div>`,
  '22-1 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">li|ne1 line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">|li^ne1 line2 a line3</div>`,
  '22-2 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">lin|e1 line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">|lin^e1 line2 a line3</div>`,
  '22-3 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line|1 line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">|line^1 line2 a line3</div>`,
  '22-4 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1| line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">|line1^ line2 a line3</div>`,
  '22-5 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 |line2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |line2 a line3</div>`,
  '22-6 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 l|ine2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |l^ine2 a line3</div>`,
  '22-7 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 li|ne2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |li^ne2 a line3</div>`,
  '22-8 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 lin|e2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |lin^e2 a line3</div>`,
  '22-9 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line|2 a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |line^2 a line3</div>`,
  '22-10 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2| a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |line2^ a line3</div>`,
  '22-11 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 |a line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |line2 ^a line3</div>`,
  '22-12 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 a| line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 |line2 a^ line3</div>`,
  '22-13 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 a |line3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 line2 a |line3</div>`,
  '22-14 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 a l|ine3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 line2 a |l^ine3</div>`,
  '22-15 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 a li|ne3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 line2 a |li^ne3</div>`,
  '22-16 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 a lin|e3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 line2 a |lin^e3</div>`,
  '22-17 rtl right lineboundary');

selection_test(
  `<div contenteditable dir="rtl" style="${kStyle}">line1 line2 a line|3</div>`,
  selection => selection.modify('extend', 'right', 'lineboundary'),
  `<div contenteditable dir="rtl" style="line-break:after-white-space; width:100px; font: 20px monospace;">line1 line2 a |line^3</div>`,
  '22-18 rtl right lineboundary');
</script>
